import { Component, OnInit } from '@angular/core';
import {Router,NavigationExtras} from '@angular/router'
@Component({
  selector: 'app-product',
  templateUrl: './product.component.html',
  styleUrls: ['./product.component.scss']
})
export class ProductComponent implements OnInit {

  constructor(public router:Router) { }

  ngOnInit(): void {
  }


  getNewsContent() {
    //js路由跳转 
    //动态路由
    this.router.navigate(['/newscontent/','1234']);
  }

  getHome() {
    //js路由跳转 
    //普通路由
    this.router.navigate(['/home']);
  }


  goNews() {
    //跳转并进行get传值
    let queryParams:NavigationExtras = {
      queryParams:{'newId':123}

    }
    this.router.navigate(['/news'],queryParams)

  }
}
